import { SReward } from "../../../../../Message/Public/SReward";
import { EReward } from "../../../../../Message/Public/EReward";
import { GameDefConfig } from "../../../resource/GameDefConfig";
import { ItemsUtil } from "../../shortcuts/item/ItemsUtil";
import { ItemData } from "../../../resource/info/ItemData";
//class RewardUtil
    
    export  class RewardUtil
    {
        

        public static getStrByReward(arg1: SReward, arg2: string="×"): string
        {
            var loc2=null;
            var loc1="";
            if (arg1) 
            {
                if (arg1.type != EReward._ERewardItem) 
                {
                    loc2 = GameDefConfig.instance.getERewardName(arg1.type);
                }
                else 
                {
                    loc2 = ItemsUtil.getItemName(new ItemData(arg1.code));
                }
                loc1 = loc2 + arg2 + arg1.num;
            }
            return loc1;
        }

        public static getStrByRewardArray(arg1: Array<any>, arg2: string): string
        {
            var loc2=null;
            var loc1="";
            var loc3=0;
            while (loc3 < arg1.length) 
            {
                loc2 = arg1[loc3];
                loc1 = loc1 + RewardUtil.getStrByReward(loc2);
                if (loc3 != (arg1.length - 1)) 
                {
                    loc1 = loc1 + arg2;
                }
                ++loc3;
            }
            return loc1;
        }
    }
